<template>
    <div class="goods">
        <div goods_header>
            <slot name="title">默认标题</slot>
        </div>
        <ul class="goods_box">
            <router-link :to="`/info/${item.goodsId}`" v-for="item in dataItem" :key="item.goodsId" tag="li"
                class="good-item">
                <div class="img">
                    <img :src="item.goodsCoverImg" alt="">
                </div>
                <div class="goods_desc">
                    <div class="title">{{ item.goodsName }}</div>
                    <div class="price">￥ {{ item.sellingPrice }}</div>
                </div>
            </router-link>
        </ul>
    </div>
</template>
<script setup>
import { defineProps } from 'vue';
defineProps({
    dataItem: {
        type: Array,
        default: []
    }
});
</script>
<style lang="less" scoped>
.goods {
    width: 100%;
    background: rgb(243, 243, 243);

    .goods_header {
        text-align: center;
        height: 50px;
        line-height: 50px;
        color: aquamarine;
    }

    .goods_box {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-content: center;

        .good-item {
            width: 49%;
            margin: 2px 0;
            box-sizing: border-box;
        }

        .img {
            width: 85%;

            img {
                width: 100%;
                height: 200px;
                overflow: hidden;
            }
        }

        .goods_desc {
            .title {
                font-size: 16px;
                color: #222333;
            }

            .price {
                margin-top: 10px;
                font-size: 16px;
                color: red;
            }
        }
    }
}
</style>